<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .niuma{
            height:35px;
        }
    </style>
</head>
<body>
<div th:replace="common/top"></div>

<div id="BackLink">
<!--    <a th:href="@{viewCategory(categoryId=${product.categoryId})}"  th:text="'Rerurn to '+${product.categoryId}">Return to ***</a>-->

    <!--                        <a th:href="@{viewProduct(productId=${product.productId})}"  th:text="${product.productId}" >productId</a>-->
</div>

<div id="Catalog">

    <h2>All orders are below</h2>
    <!--传值失败？？？？-->
    <form action="/viewOrder/searchOrder" style="margin: 10px">
        请输入关键字(userId):<input type="text" name="userId" style="margin: 10px"><button type="submit" style="margin: 10px; background: linear-gradient(
            50deg,#9cbd29, #298811)">搜索</button>
    </form>
    <div style="width:100%; height:50%; overflow:scroll;">
    <table border="1" rules="all" style="width:2000px; height:100px; text-align:center">
        <tr>
            <th class="niuma">orderid</th>
            <th class="niuma">userid</th>
            <th class="niuma">orderdate</th>
            <th class="niuma">shipaddr1</th>
            <th class="niuma">shipaddr2</th>
            <th class="niuma">shipcity</th>
            <th class="niuma">shipstate</th>
            <th class="niuma">shipzip</th>
            <th class="niuma">country</th>
            <th class="niuma">billaddr1</th>
            <th class="niuma">billaddr2</th>
            <th class="niuma">billcity</th>
            <th class="niuma">billstate</th>
            <th class="niuma">billzip</th>
            <th class="niuma">billcountry</th>
            <th class="niuma">courier</th>
            <th class="niuma">totalprice</th>
            <th class="niuma">billtofirstname</th>
            <th class="niuma">billtolastname</th>
            <th class="niuma">shiptofirstname</th>
            <th class="niuma">shiptolastname</th>
            <th class="niuma">creditcard</th>
            <th class="niuma">exprdate</th>
            <th class="niuma">cardtype</th>
            <th class="niuma">locale</th>
            <th class="niuma">alreadyShipped</th>
            <th class="niuma"发货情况</th>
            <th class="niuma">modify</th>
            <th class="niuma">delete</th>
        </tr>

        <tr th:each="order:${orderList}">
            <td th:text="${order.orderId}">1009</td>
            <td th:text="${order.username}">j2ee</td>
            <td th:text="${order.orderDate}">2021-11-07</td>
            <td th:text="${order.shipAddress1}">901 San asd</td>
            <td th:text="${order.shipAddress2}">MS UCUP02</td>
            <td th:text="${order.shipCity}">Palo Alto</td>
            <td th:text="${order.shipState}">CA</td>
            <td th:text="${order.shipZip}">94303</td>
            <td th:text="${order.shipCountry}">USA</td>
            <td th:text="${order.billAddress1}">901 San Angles</td>
            <td th:text="${order.billAddress2}">MS UCUP</td>
            <td th:text="${order.billCity}">Palo Alto</td>
            <td th:text="${order.billState}">CA</td>
            <td th:text="${order.billZip}">94303</td>
            <td th:text="${order.billCountry}">USA</td>
            <td th:text="${order.courier}">UPS</td>
            <td th:text="${order.totalPrice}">1288.5</td>
            <td th:text="${order.billToFirstName}">ABC</td>
            <td th:text="${order.billToLastName}">XYX</td>
            <td th:text="${order.shipToFirstName}">ABC</td>
            <td th:text="${order.shipToLastName}">XYX</td>
            <td th:text="${order.creditCard}">99 9999 99999 9999</td>
            <td th:text="${order.expiryDate}">12/03</td>
            <td th:text="${order.cardType}">Visa</td>
            <td th:text="${order.locale}">CA</td>
            <td th:text="${order.alreadyShipped}">是</td>
<!--            todo:动态改变上下架-->
            <td th:if="${order.alreadyShipped eq true}"><button style="    background: linear-gradient(
            50deg,#fa0404, #a81342)"><a th:href="@{/viewOrder/shipOrder(orderId=${order.orderId},isShipped=1)}" >取消发货</a></button></td>
            <td th:if="${order.alreadyShipped eq false}"><button style="    background: linear-gradient(
            50deg,#9cbd29, #298811)"><a th:href="@{/viewOrder/shipOrder(orderId=${order.orderId},isShipped=0)}">确认发货</a></button></td>
            <!--            todo:修改的url-->
            <td><button style="    background: linear-gradient(
                50deg,#04fafa, #097acc)"><a th:href="@{/viewOrder/modifyOrder(orderId=${order.orderId})}">修改</a></button></td>
            <!--            todo:删除的url-->
            <td><button style="    background: linear-gradient(
            50deg,#fa0404, #a81342)"><a th:href="@{/viewOrder/deleteOrder(orderId=${order.orderId})}">删除</a></button></td>

        </tr>


        <!--                                <c:forEach var="item" items="${sessionScope.itemList}">-->
        <!--                                        <tr>-->
        <!--                                                <td>-->
        <!--                                                        <a href="viewItem?itemId=${item.itemId}">${item.itemId}</a>-->
        <!--                                                </td>-->
        <!--                                                <td>-->
        <!--                                                        ${item.product.productId}-->
        <!--                                                </td>-->
        <!--                                                <td>-->
        <!--                                                        ${item.attribute1} ${item.attribute2} ${item.attribute3}-->
        <!--                                                        ${item.attribute4} ${item.attribute5}-->
        <!--                                                        ${sessionScope.product.name}-->
        <!--                                                </td>-->
        <!--                                                <td>-->
        <!--                                                        <fmt:formatNumber value="${item.listPrice}"-->
        <!--                                                                          pattern="$#,##0.00"/>-->
        <!--                                                </td>-->
        <!--                                                <td>-->
        <!--                                                        <a class="Button" href="addItemToCart?workingId=${item.itemId}">Add-->
        <!--                                                                to Cart</a>-->
        <!--                                                </td>-->
        <!--                                        </tr>-->
        <!--                                </c:forEach>-->
    </table>
    </div>
</div>


<div th:replace="common/bottom"></div>

</body>
</html>